package com.example.controller;

import com.example.core.utils.IdUtils;
import com.example.server.RaftServerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/*
 * @className: SysJgroupsController
 * @author: chentao
 * @date: 2025/2/21 下午4:38
 * @Version: 1.0
 * @description:
 */
@RestController
public class SysJgroupsController {

    @Resource
    private RaftServerFactory raftServerFactory;

    @RequestMapping(value = "sendMessage")
    public String sendMessage() throws Exception {
        String id = IdUtils.getId();
        return (String) raftServerFactory.getServer().sendAll(id);
    }
}
